package com.ydy.quartz;

import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;

@SpringBootApplication
@MapperScan(value = "com.ydy.quartz.mapper")
public class YdyQuartzApplication {

    private static Logger LOGGER = LoggerFactory.getLogger(YdyQuartzApplication.class);

    public static void main(String[] args) {
        LOGGER.info("定时任务服务启动...");
        SpringApplication.run(YdyQuartzApplication.class, args);
    }

    @Bean
    public SchedulerFactoryBean schedulerFactoryBean() {
        // Spring提供SchedulerFactoryBean为Scheduler提供配置信息,并被Spring容器管理其生命周期
        SchedulerFactoryBean factory = new SchedulerFactoryBean();
        return factory;
    }

}
